﻿Imports System.Data.OleDb

Public Class ExportItemDetailsDAO
    Public Function ExportItemDetails_Insert(ByVal ExportItemID As Integer, _
                                             ByVal ImportItemID As Integer, _
                                             ByVal ItemID As Integer, _
                                             ByVal Quantity As Integer, _
                                             ByVal BuyPrice As Decimal, _
                                             ByVal SellPrice As Decimal, _
                                             ByVal ExportItemDetailID As Integer) As Integer
        Dim para(6) As OleDbParameter
        Dim p As New OleDbParameter("@ExportItemID", ExportItemID)
        p.OleDbType = OleDbType.Integer
        para(0) = p

        p = New OleDbParameter("@ImportItemID", ImportItemID)
        p.OleDbType = OleDbType.Integer
        para(1) = p

        p = New OleDbParameter("@ItemID", ItemID)
        p.OleDbType = OleDbType.Integer
        para(2) = p

        p = New OleDbParameter("@Quantity", Quantity)
        p.OleDbType = OleDbType.Integer
        para(3) = p

        p = New OleDbParameter("@BuyPrice", BuyPrice)
        p.OleDbType = OleDbType.Currency
        para(4) = p

        p = New OleDbParameter("@SellPrice", SellPrice)
        p.OleDbType = OleDbType.Currency
        para(5) = p

        p = New OleDbParameter("@ExportItemDetailID", ExportItemDetailID)
        p.OleDbType = OleDbType.Integer
        p.Direction = ParameterDirection.Output
        para(6) = p

        objConnectionDAO.ExecuteStoreprocedureNoneReturn("spTDT_ExportItemDetails_Insert", para)
        Return para(6).Value

    End Function

    Public Function ExportItemDetails_Update(ByVal ExportItemDetailID As Integer, _
                                             ByVal ExportItemID As Integer, _
                                             ByVal ImportItemID As Integer, _
                                             ByVal ItemID As Integer, _
                                             ByVal OriginalQuantity As Integer, _
                                             ByVal Quantity As Integer, _
                                             ByVal SellPrice As Decimal) As Boolean
        Dim para(6) As OleDbParameter
        Dim p As New OleDbParameter("@ExportItemDetailID", ExportItemDetailID)
        p.OleDbType = OleDbType.Integer
        para(0) = p

        p = New OleDbParameter("@ExportItemID", ExportItemID)
        p.OleDbType = OleDbType.Integer
        para(1) = p

        p = New OleDbParameter("@ImportItemID", ImportItemID)
        p.OleDbType = OleDbType.Integer
        para(2) = p

        p = New OleDbParameter("@ItemID", ItemID)
        p.OleDbType = OleDbType.Integer
        para(3) = p

        p = New OleDbParameter("@OriginalQuantity", OriginalQuantity)
        p.OleDbType = OleDbType.Integer
        para(4) = p

        p = New OleDbParameter("@Quantity", Quantity)
        p.OleDbType = OleDbType.Integer
        para(5) = p

        p = New OleDbParameter("@SellPrice", SellPrice)
        p.OleDbType = OleDbType.Currency
        para(6) = p

        Return objConnectionDAO.ExecuteStoreprocedureNoneReturn("spTDT_ExportItemDetails_Update", para)
    End Function

    Public Function ExportItemDetails_Thue_Delete(ByVal ExportItemID As Integer) As Boolean
        Dim para(0) As OleDbParameter
        Dim p As New OleDbParameter("@ExportItemID", ExportItemID)
        p.OleDbType = OleDbType.Integer
        para(0) = p

        Return objConnectionDAO.ExecuteStoreprocedureNoneReturn("spTDT_ExportItemDetails_Thue_Delete", para)

    End Function
End Class
